﻿
using Microsoft.AspNetCore.Mvc;
using MyJWT;
using System.Text.Json;

namespace DataTransmissionDemo.Controllers
{
    [CheckAuth]
    [Route("/api/account")]
    public class AccountController : ControllerBase
    {
        #region key

        string publicKey = @"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs4nj5hgCQ/THG6NcOFs6/s9HFDbSlIOrWgkFgiPyxQmdjJpH2klJqfaspPcVUEmWh3lAtIJ7CRCMQMwDyqmhXcSl8QQOCl7329UNi+yYV0I4jSK/VLGeUYNOBjSlWVz7CKNUQUDAzbHJWVBf+FbKYMNA68TWHN0xHAQsq4HF4ZppAzgI6vvDqU6W9cCTfY549Davju6pXaqdvJ7ws9K+VLNKJrZuMEOeCEpE5+lidHl46FmCbAhxSzoIA9jIplEUblsmdK9tK2RXAXZJLjx59DlYJ/J8h31ejhQm9JjHiMTxS+TB/TzpcVEN2uuVBsH9MqZSt6RO7OA0Je12IAzaQQIDAQAB";
        #endregion

        /// <summary>
        /// 验签
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpGet("/CurrentUserJWT")]
        public string GetCurrentUserJWT()
        {
            var userId = HttpContext.Items["UserId"].ToString();
            return userId;
        }

    }

    public record UserInfo(string userId, string userName, int age);
}
